<?php
class Mageex_AdvanceSeo_AdvanceseoController extends Mage_Adminhtml_Controller_Action
{
    
    protected function _getHelper()
    {
        return Mage::helper('advanceseo');
    }

    public function gettemplateAction()
    {
    
        $params = $this->getRequest()->getParams();
        if(count($params)>0){
        	$collection = Mage::getResourceModel('eav/entity_attribute_collection')
            				->setEntityTypeFilter( Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId() )
            				->addFilter("is_visible", 1)
            				->addFilter("is_filterable", 1);
           	//echo $collection->getSelect()->__toString();
	        $cols = array();
            foreach($collection->getItems() as $col) {
	            $cols[] = array('value' => '{'.$col->getAttributeCode().'} ',   'label' => $col->getFrontendLabel());
	        }
			if($params['type']=='des'){
				$arr['value'] = '{short_description} ';
				$arr['label'] = 'Short Description';
				array_push($cols,$arr);
				$arr['value'] = '{description} ';
				$arr['label'] = 'Description';
				array_push($cols,$arr);
			}
			$arr['value'] = '{name} ';
			$arr['label'] = 'Product Name';
			array_push($cols,$arr);
			$arr['value'] = '{computer_manufacturers}';
			$arr['label'] = 'Brand';
			array_push($cols,$arr);
        	$this->getResponse()->setBody(Zend_Json::encode($cols));
        }
    }

}
